package demo.hw;

import java.util.ArrayList;
import java.util.List;

/**
 * 输入180
 * 输出2 2 3 3 5
 *
 * @author taqo
 * @date 2021/5/25
 */
public class _质数因子 {
    public static void main(String[] args) {
        a();
    }

    private static void a() {
        int a = 180;
        List<Integer> list = new ArrayList<>();
        for (int i = 2; i < a; i++) {
            while (a % i == 0) {
                list.add(i);
                a /= i;
            }
        }
        if (a != 1) {
            list.add(a);
        }
        System.out.println(list);
    }
}
